package com.zjuee.main;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication
@ServletComponentScan
@MapperScan(basePackages = {"com.zjuee.web.**.mapper"})
@ComponentScan(basePackages = {"com.zjuee"})
@Slf4j
public class ZjueeMainApplication {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext application = SpringApplication.run(ZjueeMainApplication.class, args);
        Environment env = application.getEnvironment();
        String port = env.getProperty("server.port");
        log.info("\n----------------------------------------------------------\n\t" +
                "Application zjuee-sow is running!  Access URLs:\n\t" +
                "Local: \t\thttp://localhost:" + port + "\n" +
                "----------------------------------------------------------");
    }

}
